﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using DataAccess.BusinessEntities;

namespace Locator.Stores.Views
{
    public class UsersStoresPresenter : Presenter<IUsersStoresView>
    {
        private readonly IStoresController controller;

        public UsersStoresPresenter([CreateNew] IStoresController controller)
        {
            this.controller = controller;
        }

        public override void OnViewLoaded()
        {
            List<Store> controllerGetStoresForCurrentUser = this.controller.GetStoresForCurrentUser();
            this.View.SetStores(controllerGetStoresForCurrentUser);
        }

        public override void OnViewInitialized()
        {
        }

        public void OnStoreDeleted(Store storeInformation)
        {
            this.controller.DeleteStoreForCurrentUser(storeInformation.Id);
        }

        public void OnStoreSearchClicked()
        {
            this.controller.Search();
        }
    }
}




